from django.conf.urls import url
from meiduo_admin.home import home_views
from meiduo_admin.user import user_views
from meiduo_admin.good import sku_views,spu_Views,specs_Views,spec_options_Views,sku_images_Views
from rest_framework_jwt.views import obtain_jwt_token
from rest_framework.routers import DefaultRouter

urlpatterns = [
    url(r'^authorizations/$',obtain_jwt_token),
    url(r'^statistical/total_count/$',home_views.UserTotalCountView.as_view()),
    url(r'^statistical/day_increment/$',home_views.UserDayIncreaseCountView.as_view()),
    url(r'^statistical/day_active/$',home_views.UserDayActiveCountView.as_view()),
    url(r'^statistical/day_orders/$',home_views.UserDayOrdersCountView.as_view()),
    url(r'^statistical/month_increment/$',home_views.UserMonthIncrementCountView.as_view()),
    url(r'^statistical/goods_day_views/$',home_views.GoodCategoryVisitCountView.as_view()),
    url(r'^users/$',user_views.UserListView.as_view()),

    #1,skus, 获取sku分类
    url(r'^skus/categories/$', sku_views.SKUCategoryView.as_view()),
    # sku spu简要信息
    url(r'^goods/simple/$', sku_views.SPUListView.as_view()),
    # spu specification信息
    url(r'^goods/(?P<spu_id>\d+)/specs/$', sku_views.SPUSpecificationListView.as_view()),

    #2,goods brand
    url(r'^goods/brands/simple/$', spu_Views.SPUBrandListView.as_view()),

    # good category
    url(r'^goods/channel/categories/$', spu_Views.SPUCategoryListView.as_view()),

    # good category(二级三级)
    url(r'^goods/channel/categories/(?P<category_id>\d+)/$', spu_Views.SubsCategoryListView.as_view()),

    # goods images
    url(r'^goods/images/$', spu_Views.SPUDetailImageView.as_view()),

    #4,goods specs simple
    url(r'^goods/specs/simple/$', spec_options_Views.SpecListView.as_view()),

    #5,skus simple
    url(r'^skus/simple/$', sku_images_Views.SKUInfoListView.as_view()),
]

#5,skus images
router = DefaultRouter()
router.register('skus/images',sku_images_Views.SKUImagesViewSet,base_name="images")
urlpatterns += router.urls

#4,specs options
router = DefaultRouter()
router.register('specs/options',spec_options_Views.SpecOptionsViewSet,base_name="options")
urlpatterns += router.urls

#3,specs
router = DefaultRouter()
router.register('goods/specs',specs_Views.SpecsViewSet,base_name="specs")
urlpatterns += router.urls

#2,goods
router = DefaultRouter()
router.register('goods',spu_Views.SPUViewSet,base_name="spu")
urlpatterns += router.urls

#1,skus
router = DefaultRouter()
router.register('skus',sku_views.SKUViewSet,base_name="skus")
urlpatterns += router.urls